<link href="${rc.getContextPath()}/manage/css/dwzCustomCss/dwz.custom.css?v=${ver}" rel="stylesheet" type="text/css">
<style>
.pageHeader.repair li{
    width:300px;float:left;padding: 5px 0px;
}
.pageHeader.repair li a,input,label{
    float:left;
}
.pageHeader.repair li label{
    text-align: left; width:100px;
}
.repair .searchContent.memo{
    padding:5px 0px;

}
.repair .searchContent.memo span.error{
    position: absolute !important;
    left: 260px;
}

dl.repairDate span.error{
    position: absolute !important;
    left: 260px;
}

div.inputError{
    width:90px;
}


.repair .searchContent.memo li textarea
{
    left:110px;position:absolute;width:435px;height:65px;
}


                
</style>
<div class="pageContent">
<!--     <form method="post" id="repairOrderForm"
    <#if step??&&step==2>
        action="${rc.getContextPath()}/manage/equipmentRepair/saveRecordOrder"
    </#if>
    <#if step??&&step==3>
        action="${rc.getContextPath()}/manage/equipmentRepair/saveCheckOrder"
    </#if> 
        
        class="pageForm required-validate"
        onsubmit="return validateCallback(this, dialogAjaxDone);">-->
        <div class="pageFormContent">
            <input type="hidden" name="id"
                value="<#if (repairOrder.orderCode)??>${repairOrder.orderCode!''}</#if>" />
            <input type="hidden" name="pattern"
                value="${pattern!''}" />
            <fieldset>
                <dl>
                    <dt><@label key='repairOrderCode.C,colon'>报修单号：</@label></dt>
                    <dd style="nowrap"><input type="text" name="orderCode"  size="22" type="text" maxlength="20" value="${repairOrder.orderCode!''}" readonly="readonly" 
                                />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='repairStatusECode.C,colon'>处理状态：</@label></dt>
                    <dd><input type="text" name="statusECode"  size="22"  maxlength="20"  readonly="readonly"
                            <#if ECode??><#list ECode as eCode>
                                <#if  repairOrder.statusECode==eCode.eCode>
                                    value="${eCode.eCodeText!''}"
                                </#if>
                            </#list></#if>
                                />
                    </dd>
                </dl>
                <dl class="lookupRepairOrder">
                    <dt><@label key="equipmentCode.C,colon">设备编号：</@label></dt>
                    <dd>
                      <input class="required"  readonly="readonly" name="equipmentCode" type="text"  value="${repairOrder.equipmentCode!''}"/>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='equipmentText.C,colon'>设备描述：</@label></dt>
                    <dd><input  readonly="readonly" size="22" type="text" maxlength="60" name="equipmentText" value="${repairOrder.equipmentText!''}" />
                    </dd>
                </dl>
                <dl  class="lookupRepairOrder">
                    <dt><@label key="failureCode.C,colon">故障代码：</@label></dt>
                    <dd>
                        <input class="required"  readonly="readonly" name="failureCode" type="text"value="${repairOrder.failureCode!''}"/>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="failureText.C,colon">故障描述：</@label></dt>
                    <dd>
                        <input readonly size="22" type="text" maxlength="60" name="failureText" value="${repairOrder.failureText!''}" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='requestUser.C,colon'>报修人：</@label></dt>
                    <dd style="nowrap"><input type="text" name="requestUser"  size="22" type="text" maxlength="20" class="required" readonly="readonly""
                                      value="${repairOrder.requestUser!''}" 
                                />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='requestDateTime.C,colon'>报修时间：</@label></dt>
                    <dd ><input type="text" id="requestDateTime" name="requestDateTime"   type="text" maxlength="30" "
                                readonly="readonly" value="${(repairOrder.requestDateTime?string('yyyy-MM-dd HH:mm'))?if_exists}"/>
                    </dd>
                </dl>
            </fieldset>
        <div class="tabs" currentIndex="0" eventType="click" >
            <div class="tabsHeader">
                <div class="tabsHeaderContent">
                    <ul>
                        <li><a href="javascript:;"><span><@label key="failureCause.C">故障原因</@label></span></a></li>
                        <li><a href="javascript:;"><span><@label key="partList.C">更换备件记录</@label></span></a></li>
                        <li><a href="javascript:;" ><span><@label key="repairMemo.C">维修内容</@label></span></a></li>
                        <li><a href="javascript:;" ><span><@label key="checkMemo.C">验收记录</@label></span></a></li>
                    </ul>
                </div>
            </div>
            <div class="tabsContent" style="height:260px">
                <div style="width:98%;" id="failureCauseTab">
                         <#if step??&&step==2>
                        <div id="failureCauseBar" class="pBar">
                            <ul class="toolBar">
                                    <input id="failureCauseCode"  type="hidden" name="failureCauseLookup.failureCauseCode" type="text" />
                                    <input id="failureCauseText"  type="hidden" name="failureCauseLookup.failureCauseText" type="text" />
                            <li><a class="add" width="750" height="350" href="${rc.getContextPath()}/manage/failureCause/failureCauseLookup?navTabId=${navTabId!''}" rel="selectFailureCause" lookupGroup="failureCauseLookup" callback="failureCause_callback"><span><@label key="add.B">新增</@label></span> </a></li>
                            <li><a href="javascript:" class="delete" onclick="failureCauseDel()"><span><@label key="delete.B">删除</@label></span> </a>
                                </li>
                            </ul>
                        </div>
                        </#if>
                        <table id="failureCauseTable"class="table border canopration" width="98%" >
                            <thead >
                                <tr>
                                    <th ><input type="checkbox" group="failureCauseCheckbox" class="checkboxCtrl"></th>
                                    <th><@label key="serialNumber.C">序号</@label></th>
                                    <th><@label key="failureCauseCode.C">故障原因编号</@label></th>
                                    <th><@label key="failureCauseText.C">故障原因描述</@label></th>
                                </tr>
                            </thead>
                            <tbody id="failureCauseBody">
                                <#if repairOrder.causes??> <#if (repairOrder.causes?size>0)> <#list repairOrder.causes as cause>
                                <tr id="failureCause_${cause.failureCauseCode!''}">
                                    <td ><input type="checkbox" name="failureCauseCheckbox" class="checkboxCtrl" value="${cause.failureCauseCode!''}"></td>
                                    <input type="hidden" name="causes[${cause_index}].failureCauseCode" value="${cause.failureCauseCode!''}">
                                    <td >${failureCause_index+1}</td>
                                    <td >${cause.failureCauseCode!''}</td>
                                    <td >${cause.failureCauseText!''}</td>
                                </tr>
                                </#list></#if></#if>
                            </tbody>
                        </table>
                </div>
                <div style="width:98%;" id="partTab">
                         <#if step??&&step==2>
                        <div id="partBar" class="pBar">
                            <ul class="toolBar">
                                    <input id="partCode"  type="hidden" name="partLookup.partCode" type="text" />
                                    <input id="partText"  type="hidden" name="partLookup.partText" type="text" />
                            <li><a class="add" width="700" height="380" href="${rc.getContextPath()}/manage/equipmentPart/partLookup?navTabId=${navTabId!''}" rel="selectPart" lookupGroup="partLookup" callback="part_callback"><span><@label key="add.B">新增</@label></span> </a></li>
                            <li><a href="javascript:" class="delete" onclick="partDel()"><span><@label key="delete.B">删除</@label></span> </a>
                                </li>
                            </ul>
                        </div>
                        </#if>
                        <table id="partTable"class="table border partTable canopration" width="98%"  >
                            <thead >
                                <tr>
                                    <th ><input type="checkbox" group="partCheckBox" class="checkboxCtrl"></th>
                                    <th><@label key="serialNumber.C">序号</@label></th>
                                    <th><@label key="partCode.C">备件编号</@label></th>
                                    <th><@label key="partText.C">备件描述</@label></th>
                                    <th><@label key="quantity.C">数量</@label></th>
                                </tr>
                            </thead>
                            <tbody id="partBody">
                                <#if repairOrder.parts??> <#if (repairOrder.parts?size>0)> <#list repairOrder.parts as part>
                                <tr id="part_${part.partCode!''}" rel="partIds">
                                    <td ><input type="checkbox" name="partCheckBox" class="checkboxCtrl" value="${part.partCode!''}"></td>
                                    <input type="hidden" name="parts[${part_index}].partCode"  value="${part.partCode!''}">
                                    <td >${part_index+1}</td>
                                    <td >${part.partCode!''}</td>
                                    <td >${part.partText!''}</td>
                                    <td ><div class='inputError'><input readonly="readonly" type="text" style="width:70px;height:19px;"name="parts[${part_index}].quantity" class='required digits' min='1' value="${part.quantity!''}"/></div></td>
                                </tr>
                                </#list></#if></#if>
                            </tbody>
                        </table>
                </div>
                <div>
                        <dl class="nowrap">
                            <dt><@label key='repairUser.C,colon'>维修人：</@label></dt>
                            <dd ><input type="text" name="repairUser" readonly="readonly" value="${repairOrder.repairUser!''}" class="required"/></dd>
                        </dl>
                        <dl class="repairDate">
                            <dt><@label key='repairStartDateTime.C,colon'>维修开始时间：</@label> </dt>
                            <dd><input type="text" class="required date"   readonly="readonly" size="17" max_Date="{repairEndDateTime}"  dateFmt="yyyy-MM-dd HH:mm" name="repairStartDateTime" value="${(repairOrder.repairStartDateTime?string('yyyy-MM-dd HH:mm'))?if_exists}" />
                            <a class="inputDateButton" href="javascript:;">选择</a>
                            </dd>
                        </dl>
                        <dl class="repairDate">    
                            <dt><@label key='repairEndDateTime.C,colon'>维修结束时间：</@label> </dt> 
                            <dd><input type="text" class="required date"   readonly="readonly" size="17" min_Date="{repairStartDateTime}"  dateFmt='yyyy-MM-dd HH:mm' name="repairEndDateTime" value="${(repairOrder.repairEndDateTime?string('yyyy-MM-dd HH:mm'))?if_exists}" />
                            <a class="inputDateButton" href="javascript:;">选择</a>
                            </dd>
                        </dl>
                        <dl class="lookupRepairOrder">
                            <dt><@label key="repairCategoryCode.C,colon">维修类别编号：</@label></dt>
                            <dd>
                              <input id="categoryCodeGrp.categoryCode" class="required"  name="categoryCode" type="text"  value="${repairOrder.categoryCode!''}"
                                   postField="categoryCode" suggestFields="categoryCode,categoryText" 
                                   suggestUrl="${rc.getContextPath()}/manage/repairCategory/repairCategoryDropdown" lookupGroup="categoryCodeGrp"
                                warn="<@label key='repairCategoryCode.C,doesNotExist.C'>维修类别编号不存在</@label>"  remote="${rc.getContextPath()}/manage/repairCategory/checkRepairCategoryCode"/>
                            </dd>
                        </dl>
                        <dl>
                            <dt><@label key='repairCategoryText.C,colon'>维修类别描述：</@label></dt>
                            <dd><input  id="categoryCodeGrp.categoryText" readonly="readonly" size="22" type="text" maxlength="60" name="categoryText" value="${repairOrder.categoryText!''}"/>
                            </dd>
                        </dl>
                        
                    
                        <dl style="height: 70px; width: 590px;">
                            <dt><@label key='repairMemo.C,colon'>维修内容：</@label> </dt>
                            <dd><textarea name="repairMemo"  style="height: 70px; width: 435px;" maxlength="200"  value="${repairOrder.repairMemo!''}" rows="2" cols="45" class="required"><#if (repairOrder.repairMemo)??>${repairOrder.repairMemo!''}</#if></textarea>
                            </dd>
                        </dl>
                        <dl style="height: 70px; width: 590px;">
                            <dt><@label key='repairResult.C,colon'>维修结果：</@label> </dt> 
                            <dd><textarea name="repairResult"style="height: 70px; width: 435px;" maxlength="200"  rows="2" cols="45"value="${repairOrder.repairResult!''}" class="required"><#if (repairOrder.repairResult)??>${repairOrder.repairResult!''}</#if></textarea>
                            </dd>
                        </dl>
                </div>
                <div>
                        <dl class="searchContent">
                            <dt> <@label key='checkUser.C,colon'>验证人：</@label> </dt> 
                            <dd><input type="text" name="_checkUser" value="${repairOrder.checkUser!''}" readonly="readonly" /></dd>
                        </dl>
                        <dl>
                            <dt><@label key='shutdownStartDatetime.C,colon'>停线开始时间：</@label></dt>
                            <dd><input type="text"  readonly="readonly" size="17" name="_shutdownStartDatetime" value="${(repairOrder.shutdownStartDatetime?string('yyyy-MM-dd HH:mm'))?if_exists}" />
                            </dd>
                            </dl>
                        <dl class="repairDate">
                            <dt><@label key='shutdownEndDatetime.C,colon'>停线结束时间：</@label></dt>
                            <dd><input type="text"  readonly="readonly" size="17"   dateFmt='yyyy-MM-dd HH:mm' name="_shutdownEndDatetime" value="${(repairOrder.shutdownEndDatetime?string('yyyy-MM-dd HH:mm'))?if_exists}" />
                            </dd>
                        </dl>
                        <dl  style="height: 70px; width: 590px;">
                            <dt><@label key='checkMemo.C,colon'>验收内容：</@label> </dt> 
                            <dd><textarea name="_checkMemo"  style="height: 70px; width: 435px;"maxlength="200" readonly="readonly" value="${repairOrder.checkMemo!''}" rows="2"><#if (repairOrder.checkMemo)??>${repairOrder.checkMemo!''}</#if></textarea>
                            </dd>
                        </dl>
                        <dl  style="height: 70px; width: 590px;">
                            <dt><@label key='checkResult.C,colon'>验收结果：</@label> </dt> 
                            <dd><textarea name="_checkResult"  style="height: 70px; width: 435px;" maxlength="200" readonly="readonly" value="${repairOrder.checkResult!''}" rows="2"><#if (repairOrder.checkResult)??>${repairOrder.checkResult!''}</#if></textarea>
                            </dd>
                        </dl>
                </div>
            </div>
            <div class="tabsFooter">
                <div class="tabsFooterContent"></div>
            </div>
        </div>
        </div>
        <#if step??&&step=2>
         <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit"><@label key="agree.C">同意</@label></button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        </#if>
</div>


<script>
function failureCause_callback(){
    var code=$("#failureCauseCode").val().split(',');
    var text=$("#failureCauseText").val().split(',');
    var len=code.length;
    var tr='';
    var gridTheadTh = $("#failureCauseTab").find("table thead th");
    var statrtNum=$("#failureCauseTab tbody tr").length;
    for(var i=0;i<len;i++)
    {
        var existCode=$("tr#failureCause_"+code[i]).length;
        if(existCode==0){
            statrtNum++;
         tr+="<tr id='failureCause_"+code[i]+"'>"+
             "<td style='width:"+$(gridTheadTh[0]).width()+"px'>"+"<input type='checkbox' name='failureCauseCheckbox'"+"class='checkboxCtrl' value='"+code[i]+"'></td>"+
             "<input type='hidden' name='"+"causes["+(statrtNum-1)+"].failureCauseCode'"+" value='"+code[i]+"'>"+
             "<td style='width:"+$(gridTheadTh[1]).width()+"px'>"+(statrtNum)+"</td>"+
             "<td style='width:"+$(gridTheadTh[2]).width()+"px'>"+code[i]+"</td>"+
             "<td style='width:"+$(gridTheadTh[3]).width()+"px'>"+text[i]+"</td></tr>"; 
        }
    }
    $("#failureCauseTab tbody").append(tr);
    
}
function failureCauseDel() {
    
    var count = 0;
    $('#failureCauseTab input[name="failureCauseCheckbox"]:checked').each(function(i, e) {
        count++;
    });
    if (count == 0) {
        alertMsg.warn('<@label key="selectFailureCause.M">请勾选错误原因！</@label>')
    } else {
        alertMsg.confirm('<@label key="delFailureCause.M">确定要删除选中的勾选错误原因？</@label>', {
            okCall : function() {
                var gridTheadTh = $("#failureCauseTab").find("table thead th");
                $('#failureCauseTab input[name="failureCauseCheckbox"]:checked').each(function(i, e) {
                    $("#failureCause_" + e.value).remove();
                });
            
            }
        });
    }
}


function part_callback(){
    var code=$("#partCode").val().split(',');
    var text=$("#partText").val().split(',');
    var len=code.length;
    var tr='';
    var gridTheadTh = $("#partTab").find("table thead th");
    var statrtNum=$("#partTab tbody tr").length;
    for(var i=0;i<len;i++)
    {
        var existCode=$("tr#part_"+code[i]).length;
        if(existCode==0){
            statrtNum++;
         tr+="<tr id='part_"+code[i]+"'>"+
             "<td style='width:"+$(gridTheadTh[0]).width()+"px'>"+"<input type='checkbox' name='partCheckBox'"+" class='checkboxCtrl' value='"+code[i]+"'></td>"+
             "<input type='hidden' name='"+"parts["+(statrtNum-1)+"].partCode'"+"value='"+code[i]+"'>"+
             "<td style='width:"+$(gridTheadTh[1]).width()+"px'>"+(statrtNum)+"</td>"+
             "<td style='width:"+$(gridTheadTh[2]).width()+"px'>"+code[i]+"</td>"+
             "<td style='width:"+$(gridTheadTh[3]).width()+"px'>"+text[i]+"</td>"+
             "<td style='width:"+$(gridTheadTh[4]).width()+"px'>"+"<div class='inputError'><input type='text' style='width:70px;height:19px;' name='"+"parts["+(statrtNum-1)+"].quantity'"+" class='required digits' min='1' value='${part.quantity!''}'/></div></td></tr>"; 
        }
    }
    $("#partTab tbody").append(tr);
    
}
function partDel() {
    var count = 0;
    $('#partTab input[name="partCheckBox"]:checked').each(function(i, e) {
        count++;
    });
    if (count == 0) {
        alertMsg.warn('<@label key="selectPart.M">请勾选备件！</@label>')
    } else {
        alertMsg.confirm('<@label key="delPart.M">确定要删除选中的勾选备件？</@label>', {
            okCall : function() {
                $('#partTab input[name="partCheckBox"]:checked').each(function(i, e) {
                    $("#partTab #part_" + e.value).remove();
                });
            }
        });
    }
}

function check(){
    $('#failureCauseBody input[type="checkbox"]',$.pdialog.getCurrent()).attr("checked", true);
    $('#partBody input[type="checkbox"]',$.pdialog.getCurrent()).attr("checked", true);
}


</script>